#ifndef TASK_QUEUE_H_
#define TASK_QUEUE_H_

#include <pthread.h>

typedef struct task_s {
  int netfd;
  struct task_s *next;
} task_t;

typedef struct task_queue_s {
  task_t *front;
  task_t *rear;
  int size;
  pthread_mutex_t mutex;
  pthread_cond_t cond;
} task_queue_t;

int task_enqueue(task_queue_t *task_queue, int netfd);
int task_dequeue(task_queue_t *task_queue);
int task_queue_empty(task_queue_t *task_queue);
task_queue_t *task_queue_create();

#endif
